home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / elispman.lha / elispman / elisp-28 (.txt) < prev    next >
GNU Info File  |  1993-06-01  |  47KB  |  881 lines

  1. This is Info file elisp, produced by Makeinfo-1.55 from the input file
  2. elisp.texi.
  3.    This is edition 2.0 of the GNU Emacs Lisp Reference Manual, for
  4. Emacs Version 19.
  5.    Published by the Free Software Foundation, 675 Massachusetts Avenue,
  6. Cambridge, MA 02139 USA
  7.    Copyright (C) 1990, 1991, 1992, 1993 Free Software Foundation, Inc.
  8.    Permission is granted to make and distribute verbatim copies of this
  9. manual provided the copyright notice and this permission notice are
  10. preserved on all copies.
  11.    Permission is granted to copy and distribute modified versions of
  12. this manual under the conditions for verbatim copying, provided that
  13. the entire resulting derived work is distributed under the terms of a
  14. permission notice identical to this one.
  15.    Permission is granted to copy and distribute translations of this
  16. manual into another language, under the above conditions for modified
  17. versions, except that this permission notice may be stated in a
  18. translation approved by the Foundation.
  19. File: elisp,  Node: Emacs Display,  Next: Calendar,  Prev: System Interface,  Up: Top
  20. Emacs Display
  21. *************
  22.    This chapter describes a number of features related to the display
  23. that Emacs presents to the user.
  24. * Menu:
  25. * Refresh Screen::      Clearing the screen and redrawing everything on it.
  26. * Screen Size::         How big is the Emacs screen.
  27. * Truncation::          Folding or wrapping long text lines.
  28. * The Echo Area::       Where messages are displayed.
  29. * Selective Display::   Hiding part of the buffer text.
  30. * Overlay Arrow::       Display of an arrow to indicate position.
  31. * Temporary Displays::  Displays that go away automatically.
  32. * Overlays::        Use overlays to highlight parts of the buffer.
  33. * Faces::        A face defines a graphics appearance: font, color, etc.
  34. * Blinking::            How Emacs shows the matching open parenthesis.
  35. * Inverse Video::    Specifying how the screen looks.
  36. * Usual Display::    The usual conventions for displaying nonprinting chars.
  37. * Display Tables::    How to specify other conventions.
  38. * Beeping::             Audible signal to the user.
  39. * Window Systems::      Which window system is being used.
  40. File: elisp,  Node: Refresh Screen,  Next: Screen Size,  Up: Emacs Display
  41. Refreshing the Screen
  42. =====================
  43.    The function `redraw-frame' redisplays the entire contents of a
  44. given frame.  *Note Frames::.
  45.  - Function: redraw-frame FRAME
  46.      This function clears and redisplays frame FRAME.
  47.    Even more powerful is `redraw-display'.
  48.  - Command: redraw-display
  49.      This function clears and redisplays all visible frames.
  50.    Normally, suspending and resuming Emacs also refreshes the screen.
  51. Some terminal emulators record separate contents for display-oriented
  52. programs such as Emacs and for ordinary sequential display.  If you are
  53. using such a terminal, you might want to inhibit the redisplay on
  54. resumption.  *Note Suspending Emacs::.
  55.  - Variable: no-redraw-on-reenter
  56.      This variable controls whether Emacs redraws the entire screen
  57.      after it has been suspended and resumed.  Non-`nil' means yes,
  58.      `nil' means no.
  59.    Processing user input takes absolute priority over redisplay.  If you
  60. call these functions when input is available, they do nothing
  61. immediately, but a full redisplay does happen eventually--after all the
  62. input has been processed.
  63. File: elisp,  Node: Screen Size,  Next: Truncation,  Prev: Refresh Screen,  Up: Emacs Display
  64. Screen Size
  65. ===========
  66.    The screen size functions report or tell Emacs the height or width of
  67. the terminal.  When you are using multiple frames, they apply to the
  68. selected frame (*note Frames::.).
  69.  - Function: screen-height
  70.      This function returns the number of lines on the screen that are
  71.      available for display.
  72.           (screen-height)
  73.                => 50
  74.  - Function: screen-width
  75.      This function returns the number of columns on the screen that are
  76.      available for display.
  77.           (screen-width)
  78.                => 80
  79.  - Function: set-screen-height LINES &optional NOT-ACTUAL-SIZE
  80.      This function declares that the terminal can display LINES lines.
  81.      The sizes of existing windows are altered proportionally to fit.
  82.      If NOT-ACTUAL-SIZE is non-`nil', then Emacs displays LINES lines
  83.      of output, but does not change its value for the actual height of
  84.      the screen.  (Knowing the correct actual size may be necessary for
  85.      correct cursor positioning.)  Using a smaller height than the
  86.      terminal actually implements may be useful to reproduce behavior
  87.      observed on a smaller screen, or if the terminal malfunctions when
  88.      using its whole screen.
  89.      If LINES is different from what it was previously, then the entire
  90.      screen is cleared and redisplayed using the new size.
  91.      This function returns `nil'.
  92.  - Function: set-screen-width COLUMNS &optional NOT-ACTUAL-SIZE
  93.      This function declares that the terminal can display COLUMNS
  94.      columns.  The details are as in `set-screen-height'.
  95. File: elisp,  Node: Truncation,  Next: The Echo Area,  Prev: Screen Size,  Up: Emacs Display
  96. Truncation
  97. ==========
  98.    When a line of text extends beyond the right edge of a window, the
  99. line can either be truncated or continued on the next line.  When a line
  100. is truncated, this is shown with a `$' in the rightmost column of the
  101. window.  When a line is continued or "wrapped" onto the next line, this
  102. is shown with a `\' on the rightmost column of the window.  The
  103. additional screen lines used to display a long text line are called
  104. "continuation" lines.  (Note that wrapped lines are not filled; filling
  105. has nothing to do with continuation and truncation.  *Note Filling::.)
  106.  - User Option: truncate-lines
  107.      This buffer-local variable controls how Emacs displays lines that
  108.      extend beyond the right edge of the window.  If it is non-`nil',
  109.      then Emacs does not display continuation lines; rather each line of
  110.      text occupies exactly one screen line, and a dollar sign appears
  111.      at the edge of any line that extends to or beyond the edge of the
  112.      window.  The default is `nil'.
  113.      If the variable `truncate-partial-width-windows' is non-`nil',
  114.      then truncation is used for windows that are not the full width of
  115.      the screen, regardless of the value of `truncate-lines'.
  116.  - Variable: default-truncate-lines
  117.      This variable is the default value for `truncate-lines' in buffers
  118.      that do not have local values for it.
  119.  - User Option: truncate-partial-width-windows
  120.      This variable determines how lines that are too wide to fit on the
  121.      screen are displayed in side-by-side windows (*note Splitting
  122.      Windows::.).  If it is non-`nil', then wide lines are truncated
  123.      (with a `$' at the end of the line); otherwise they wrap to the
  124.      next screen line (with a `\' at the end of the line).
  125.    You can override the images that indicate continuation or truncation
  126. with the display table; see *Note Display Tables::.
  127. File: elisp,  Node: The Echo Area,  Next: Selective Display,  Prev: Truncation,  Up: Emacs Display
  128. The Echo Area
  129. =============
  130.    The "echo area" is used for displaying messages made with the
  131. `message' primitive, and for echoing keystrokes.  It is not the same as
  132. the minibuffer, despite the fact that the minibuffer appears (when
  133. active) in the same place on the screen as the echo area.  The `GNU
  134. Emacs Manual' specifies the rules for resolving conflicts between the
  135. echo area and the minibuffer for use of that screen space (*note The
  136. Minibuffer: (emacs)Minibuffer.).  Error messages appear in the echo
  137. area; see *Note Errors::.
  138.    You can write output in the echo area by using the Lisp printing
  139. functions with `t' as the stream (*note Output Functions::.), or as
  140. follows:
  141.  - Function: message STRING &rest ARGUMENTS
  142.      This function prints a one-line message in the echo area.  The
  143.      argument STRING is similar to a C language `printf' control
  144.      string.  See `format' in *Note String Conversion::, for the details
  145.      on the conversion specifications.  `message' returns the
  146.      constructed string.
  147.      If STRING is `nil', `message' clears the echo area.  If the
  148.      minibuffer is active, this brings the minibuffer contents back onto
  149.      the screen immediately.
  150.           (message
  151.            "Minibuffer depth is %d."
  152.            (minibuffer-depth))
  153.           => "Minibuffer depth is 0."
  154.           
  155.           ---------- Echo Area ----------
  156.           Minibuffer depth is 0.
  157.           ---------- Echo Area ----------
  158.  - Variable: cursor-in-echo-area
  159.      This variable controls where the cursor appears when a message is
  160.      displayed in the echo area.  If it is non-`nil', then the cursor
  161.      appears at the end of the message.  Otherwise, the cursor appears
  162.      at point--not in the echo area at all.
  163.      The value is normally `nil'; Lisp programs bind it to `t' for
  164.      brief periods of time.
  165. File: elisp,  Node: Selective Display,  Next: Overlay Arrow,  Prev: The Echo Area,  Up: Emacs Display
  166. Selective Display
  167. =================
  168.    "Selective display" is a class of minor modes in which specially
  169. marked lines do not appear on the screen, or in which highly indented
  170. lines do not appear.
  171.    The first variant, explicit selective display, is designed for use in
  172. a Lisp program.  The program controls which lines are hidden by altering
  173. the text.  Outline mode uses this variant.  In the second variant, the
  174. choice of lines to hide is made automatically based on indentation.
  175. This variant is designed as a user-level feature.
  176.    The way you control explicit selective display is by replacing a
  177. newline (control-j) with a control-m.  The text which was formerly a
  178. line following that newline is now invisible.  Strictly speaking, it is
  179. temporarily no longer a line at all, since only newlines can separate
  180. lines; it is now part of the previous line.
  181.    Selective display does not directly affect editing commands.  For
  182. example, `C-f' (`forward-char') moves point unhesitatingly into
  183. invisible space.  However, the replacement of newline characters with
  184. carriage return characters affects some editing commands.  For example,
  185. `next-line' skips invisible lines, since it searches only for newlines.
  186. Modes that use selective display can also define commands that take
  187. account of the newlines, or which make parts of the text visible or
  188. invisible.
  189.    When you write a selectively displayed buffer into a file, all the
  190. control-m's are replaced by their original newlines.  This means that
  191. when you next read in the file, it looks OK, with nothing invisible.
  192. The selective display effect is seen only within Emacs.
  193.  - Variable: selective-display
  194.      This buffer-local variable enables selective display.  This means
  195.      that lines, or portions of lines, may be made invisible.
  196.         * If the value of `selective-display' is `t', then any portion
  197.           of a line that follows a control-m is not displayed.
  198.         * If the value of `selective-display' is a positive integer,
  199.           then lines that start with more than `selective-display'
  200.           columns of indentation are not displayed.
  201.      When some portion of a buffer is invisible, the vertical movement
  202.      commands operate as if that portion did not exist, allowing a
  203.      single `next-line' command to skip any number of invisible lines.
  204.      However, character movement commands (such as `forward-char') do
  205.      not skip the invisible portion, and it is possible (if tricky) to
  206.      insert or delete text in an invisible portion.
  207.      In the examples below, what is shown is the *display* of the buffer
  208.      `foo', which changes with the value of `selective-display'.  The
  209.      *contents* of the buffer do not change.
  210.           (setq selective-display nil)
  211.                => nil
  212.           
  213.           ---------- Buffer: foo ----------
  214.           1 on this column
  215.            2on this column
  216.             3n this column
  217.             3n this column
  218.            2on this column
  219.           1 on this column
  220.           ---------- Buffer: foo ----------
  221.           
  222.           (setq selective-display 2)
  223.                => 2
  224.           
  225.           ---------- Buffer: foo ----------
  226.           1 on this column
  227.            2on this column
  228.            2on this column
  229.           1 on this column
  230.           ---------- Buffer: foo ----------
  231.  - Variable: selective-display-ellipses
  232.      If this buffer-local variable is non-`nil', then Emacs displays
  233.      `...' at the end of a line that is followed by invisible text.
  234.      This example is a continuation of the previous one.
  235.           (setq selective-display-ellipses t)
  236.                => t
  237.           
  238.           ---------- Buffer: foo ----------
  239.           1 on this column
  240.            2on this column ...
  241.            2on this column
  242.           1 on this column
  243.           ---------- Buffer: foo ----------
  244.      You can use a display table to substitute other text for the
  245.      ellipsis (`...').  *Note Display Tables::.
  246. File: elisp,  Node: Overlay Arrow,  Next: Temporary Displays,  Prev: Selective Display,  Up: Emacs Display
  247. Overlay Arrow
  248. =============
  249.    The "overlay arrow" is useful for directing the user's attention to
  250. a particular line in a buffer.  For example, in the modes used for
  251. interface to debuggers, the overlay arrow indicates the line of code
  252. about to be executed.
  253.  - Variable: overlay-arrow-string
  254.      This variable holds the string to display as an arrow, or `nil' if
  255.      the arrow feature is not in use.
  256.  - Variable: overlay-arrow-position
  257.      This variable holds a marker which indicates where to display the
  258.      arrow.  It should point at the beginning of a line.  The arrow
  259.      text is displayed at the beginning of that line, overlaying any
  260.      text that would otherwise appear.  Since the arrow is usually
  261.      short, and the line usually begins with indentation, normally
  262.      nothing significant is overwritten.
  263.      The overlay string is displayed only in the buffer which this
  264.      marker points into.  Thus, only one buffer can have an overlay
  265.      arrow at any given time.
  266. File: elisp,  Node: Temporary Displays,  Next: Overlays,  Prev: Overlay Arrow,  Up: Emacs Display
  267. Temporary Displays
  268. ==================
  269.    Temporary displays are used by commands to put output into a buffer
  270. and then present it to the user for perusal rather than for editing.
  271. Many of the help commands use this feature.
  272.  - Special Form: with-output-to-temp-buffer BUFFER-NAME FORMS...
  273.      This function executes FORMS while arranging to insert any output
  274.      they print into the buffer named BUFFER-NAME.  The buffer is then
  275.      shown in some window for viewing, displayed but not selected.
  276.      The string BUFFER-NAME specifies the temporary buffer, which need
  277.      not already exist.  The argument must be a string, not a buffer.
  278.      The buffer is erased initially (with no questions asked), and it is
  279.      marked as unmodified after `with-output-to-temp-buffer' exits.
  280.      `with-output-to-temp-buffer' binds `standard-output' to the
  281.      temporary buffer, then it evaluates the forms in FORMS.  Output
  282.      using the Lisp output functions within FORMS goes by default to
  283.      that buffer (but screen display and messages in the echo area,
  284.      although output in the general sense of the word, are not
  285.      affected).  *Note Output Functions::.
  286.      The value of the last form in FORMS is returned.
  287.           ---------- Buffer: foo ----------
  288.            This is the contents of foo.
  289.           ---------- Buffer: foo ----------
  290.           
  291.           (with-output-to-temp-buffer "foo"
  292.               (print 20)
  293.               (print standard-output))
  294.           => #<buffer foo>
  295.           
  296.           ---------- Buffer: foo ----------
  297.           20
  298.           
  299.           #<buffer foo>
  300.           
  301.           ---------- Buffer: foo ----------
  302.  - Variable: temp-buffer-show-function
  303.      The value of this variable, if non-`nil', is called as a function
  304.      to display a help buffer.  This variable is used by
  305.      `with-output-to-temp-buffer'.
  306.      In Emacs versions 18 and earlier, this variable was called
  307.      `temp-buffer-show-hook'.
  308.  - Function: momentary-string-display STRING POSITION &optional CHAR
  309.           MESSAGE
  310.      This function momentarily displays STRING in the current buffer at
  311.      POSITION (which is a character offset from the beginning of the
  312.      buffer).  The display remains until the next character is typed.
  313.      If the next character the user types is CHAR, Emacs ignores it.
  314.      Otherwise, that character remains buffered for subsequent use as
  315.      input.  Thus, typing CHAR will simply remove the string from the
  316.      display, while typing (say) `C-f' will remove the string from the
  317.      display and later (presumably) move point forward.  The argument
  318.      CHAR is a space by default.
  319.      The return value of `momentary-string-display' is not meaningful.
  320.      If MESSAGE is non-`nil', it is displayed in the echo area while
  321.      STRING is displayed in the buffer.  If it is `nil', then
  322.      instructions to type CHAR are displayed there, e.g., `Type RET to
  323.      continue editing'.
  324.      In this example, point is initially located at the beginning of the
  325.      second line:
  326.           ---------- Buffer: foo ----------
  327.           This is the contents of foo.
  328.           -!-Second line.
  329.           ---------- Buffer: foo ----------
  330.           
  331.           (momentary-string-display
  332.              "**** Important Message! ****" (point) ?\r
  333.              "Type RET when done reading")
  334.           => t
  335.           
  336.           ---------- Buffer: foo ----------
  337.           This is the contents of foo.
  338.           **** Important Message! ****Second line.
  339.           ---------- Buffer: foo ----------
  340.           
  341.           ---------- Echo Area ----------
  342.           Type RET when done reading
  343.           ---------- Echo Area ----------
  344.      This function works by actually changing the text in the buffer.
  345.      As a result, if you later undo in this buffer, you will see the
  346.      message come and go.
  347. File: elisp,  Node: Overlays,  Next: Faces,  Prev: Temporary Displays,  Up: Emacs Display
  348. Overlays
  349. ========
  350.    You can use "overlays" to alter the appearance of a buffer's text on
  351. the screen.  An overlay is an object which belongs to a particular
  352. buffer, and has a specified beginning and end.  It also has properties
  353. which you can examine and set; these affect the display of the text
  354. within the overlay.
  355. * Menu:
  356. * Overlay Properties::    How to read and set properties.
  357.             What properties do to the screen display.
  358. * Managing Overlays::   Creating, moving, finding overlays.
  359. File: elisp,  Node: Overlay Properties,  Next: Managing Overlays,  Up: Overlays
  360. Overlay Properties
  361. ------------------
  362.    Overlay properties are like text properties in some respects, but the
  363. differences are more important than the similarities.  Text properties
  364. are considered a part of the text; overlays are specifically considered
  365. not to be part of the text.  Thus, copying text between various buffers
  366. and strings preserves text properties, but does not try to preserve
  367. overlays.  Changing a buffer's text properties marks the buffer as
  368. modified, while moving an overlay or changing its properties does not.
  369. `face'
  370.      This property controls the font and color of text.  *Note Faces::,
  371.      for more information.  This feature is temporary; in the future,
  372.      we may replace it with other ways of specifying how to display
  373.      text.
  374. `mouse-face'
  375.      This property is used instead of `face' when the mouse is within
  376.      the range of the overlay.  This feature is not yet implemented,
  377.      and may be temporary.  It is documented here because we are likely
  378.      to implement it this way at least for a while.
  379. `priority'
  380.      This property's value (which should be a nonnegative number)
  381.      determines the priority of the overlay.  The priority matters when
  382.      two or more overlays cover the same character and both specify a
  383.      face for display; the one whose `priority' value is larger takes
  384.      priority over the other, and its face attributes override the face
  385.      attributes of the lower priority overlay.
  386.      Currently, all overlays take priority over text properties.  Please
  387.      avoid using negative priority values, as we have not yet decided
  388.      just what they should mean.
  389. `window'
  390.      If the `window' property is non-`nil', then the overlay applies
  391.      only on that window.
  392. `before-string'
  393.      This property's value is a string to add to the display at the
  394.      beginning of the overlay.  The string does not appear in the
  395.      buffer in any sense--only on the screen.  This is not yet
  396.      implemented, but will be.
  397. `after-string'
  398.      This property's value is a string to add to the display at the end
  399.      of the overlay.  The string does not appear in the buffer in any
  400.      sense--only on the screen.  This is not yet implemented, but will
  401.      be.
  402.    These are the functions for reading and writing the properties of an
  403. overlay.
  404.  - Function: overlay-get OVERLAY PROP
  405.      This function returns the value of property PROP recorded in
  406.      OVERLAY.  If OVERLAY does not record any value for that property,
  407.      then the value is `nil'.
  408.  - Function: overlay-put OVERLAY PROP VALUE
  409.      This function set the value of property PROP recorded in OVERLAY
  410.      to VALUE.  It returns VALUE.
  411. File: elisp,  Node: Managing Overlays,  Prev: Overlay Properties,  Up: Overlays
  412. Managing Overlays
  413. -----------------
  414.  - Function: make-overlay START END &optional BUFFER
  415.      This function creates and returns an overlay which belongs to
  416.      BUFFER and ranges from START to END.  Both START and END must
  417.      specify buffer positions; they may be integers or markers.  If
  418.      BUFFER is omitted, the overlay is created in the current buffer.
  419.      The return value is the overlay itself.
  420.  - Function: overlay-start OVERLAY
  421.      This function returns the position at which OVERLAY starts.
  422.  - Function: overlay-end OVERLAY
  423.      This function returns the position at which OVERLAY ends.
  424.  - Function: overlay-buffer OVERLAY
  425.      This function returns the buffer that OVERLAY belongs to.
  426.  - Function: delete-overlay OVERLAY
  427.      This function deletes OVERLAY.  The overlay continues to exist as
  428.      a Lisp object, but ceases to be part of the buffer it belonged to,
  429.      and ceases to have any effect on display.
  430.  - Function: move-overlay OVERLAY START END &optional BUFFER
  431.      This function moves OVERLAY to BUFFER, and places its bounds at
  432.      START and END.  Both arguments START and END must specify buffer
  433.      positions; they may be integers or markers.  If BUFFER is omitted,
  434.      the overlay stays in the same buffer.
  435.      The return value is OVERLAY.
  436.      This is the only valid way to change the endpoints of an overlay.
  437.      Do not try modifying the markers in the overlay by hand, as that
  438.      fails to update other vital data structures and can cause some
  439.      overlays to be "lost".
  440.  - Function: overlays-at POS
  441.      This function returns a list of all the overlays that contain
  442.      position POS in the current buffer.  The list is in no particular
  443.      order.  An overlay contains position POS if it begins at or before
  444.      POS, and ends after POS.
  445.  - Function: next-overlay-change POS
  446.      This function returns the buffer position of the next beginning or
  447.      end of an overlay, after POS.
  448. File: elisp,  Node: Faces,  Next: Blinking,  Prev: Overlays,  Up: Emacs Display
  449. Faces
  450. =====
  451.    A "face" is a named collection of graphical attributes: font,
  452. foreground color, background color and optional underlining.  Faces
  453. control the display of text on the screen.
  454.    Each face has its own "face id number" which distinguishes faces at
  455. low levels within Emacs.  However, for most purposes, you can refer to
  456. faces in Lisp programs by their names.
  457.    Each face name is meaningful for all frames, and by default it has
  458. the same meaning in all frames.  But you can arrange to give a
  459. particular face name a special meaning in one frame if you wish.
  460.    The face named `default' is used for ordinary text.  The face named
  461. `modeline' is used for displaying the mode line and menu bars.  The
  462. face named `region' is used for highlighting the region (in Transient
  463. Mark mode only).
  464. * Menu:
  465. * Merging Faces::    How Emacs decides which face to use for a character.
  466. * Face Functions::    How to define and examine faces.
  467. File: elisp,  Node: Merging Faces,  Next: Face Functions,  Up: Faces
  468. Merging Faces for Display
  469. -------------------------
  470.    Here are all the ways to specify which face to use for display of
  471. text:
  472.    * With defaults.  Each frame has a "default face", whose id number is
  473.      zero, which is used for all text that doesn't somehow specify
  474.      another face.
  475.    * With text properties.  A character may have a `face' property; if
  476.      so, it's displayed with that face.  If the character has a
  477.      `mouse-face' property, that is used instead of the `face' property
  478.      when the mouse is "near enough" to the character.  *Note Special
  479.      Properties::.
  480.    * With overlays.  An overlay may have `face' and `mouse-face'
  481.      properties too; they apply to all the text covered by the overlay.
  482.    * With special glyphs.  Each glyph can specify a particular face id
  483.      number.  *Note Glyphs::.
  484.    If these various sources together specify more than one face for a
  485. particular character, Emacs merges the attributes of the various faces
  486. specified.  The attributes of the faces of special glyphs come first;
  487. then come attributes of faces from overlays, followed by those from text
  488. properties, and last the default face.
  489.    When multiple overlays cover one character, an overlay with higher
  490. priority overrides those with lower priority.  *Note Overlays::.
  491.    If an attribute such as the font or a color is not specified in any
  492. of the above ways, the frame's own font or color is used.
  493. File: elisp,  Node: Face Functions,  Prev: Merging Faces,  Up: Faces
  494. Functions for Working with Faces
  495. --------------------------------
  496.    The attributes a face can specify include the font, the foreground
  497. color, the background color, and underlining.  The face can also leave
  498. these unspecified by giving the value `nil' for them.
  499.    Here are the primitives for creating and changing faces.
  500.  - Function: make-face NAME
  501.      This function defines a new face named NAME, initially with all
  502.      attributes `nil'.  It does nothing if there is already a face named
  503.      NAME.
  504.  - Function: face-list
  505.      This function returns a list of all defined face names.
  506.  - Function: copy-face OLD-FACE NEW-NAME &optional FRAME
  507.      This function defines a new face named NEW which is a copy of the
  508.      existing face named OLD.  If there is already a face named NEW,
  509.      then it alters the face to have the same attributes as OLD.
  510.      If the optional argument FRAME is given, this function applies
  511.      only to that frame.  Otherwise it applies to each frame
  512.      individually.
  513.    You can modify the attributes of an existing face with the following
  514. functions.  If you specify FRAME, they affect just that frame;
  515. otherwise, they affect all frames as well as the defaults that apply to
  516. new frames.
  517.  - Function: set-face-foreground FACE COLOR &optional FRAME
  518.  - Function: set-face-background FACE COLOR &optional FRAME
  519.      These functions set the foreground (respectively, background)
  520.      color of face FACE to COLOR.  The argument COLOR color should be a
  521.      string, the name of a color.
  522.  - Function: set-face-font FACE FONT &optional FRAME
  523.      This function sets the font of face FACE.  The argument FONT
  524.      should be a string.
  525.  - Function: set-face-underline-p FACE UNDERLINE-P &optional FRAME
  526.      This function sets the underline attribute of face FACE.
  527.  - Function: invert-face FACE &optional FRAME
  528.      Swap the foreground and background colors of face FACE.  If the
  529.      face doesn't specify both foreground and background, then its
  530.      foreground and background are set to the default background and
  531.      foreground.
  532.    These functions examine the attributes of a face.  If you don't
  533. specify FRAME, they refer to the default data for new frames.
  534.  - Function: face-foreground FACE &optional FRAME
  535.  - Function: face-background FACE &optional FRAME
  536.      These functions return the foreground (respectively, background)
  537.      color of face FACE.  The argument COLOR color should be a string,
  538.      the name of a color.
  539.  - Function: face-font FACE &optional FRAME
  540.      This function returns the name of the font of face FACE.
  541.  - Function: face-underline-p FACE &optional FRAME
  542.      This function returns the underline attribute of face FACE.
  543.  - Function: face-id-number FACE
  544.      This function returns the id number of face FACE.
  545.  - Function: face-equal FACE1 FACE2 &optional FRAME
  546.      This returns `t' if the faces FACE1 and FACE2 have the same
  547.      attributes for display.
  548.  - Function: face-differs-from-default-p FACE &optional FRAME
  549.      This returns `t' if the face FACE displays differently from the
  550.      default face.  A face is considered to be "the same" as the normal
  551.      face if each attribute is either the same as that of the default
  552.      face or `nil' (meaning to inherit from the default).
  553.  - Variable: region-face
  554.      This variable's value specifies the face id to use to display
  555.      characters in the region when it is active (in Transient Mark mode
  556.      only).  The face thus specified takes precedence over all faces
  557.      that come from text properties and overlays, for characters in the
  558.      region.  *Note The Mark::, for more information about Transient
  559.      Mark mode.
  560.      Normally, the value is the id number of the face named `region'.
  561. File: elisp,  Node: Blinking,  Next: Inverse Video,  Prev: Faces,  Up: Emacs Display
  562. Blinking
  563. ========
  564.    This section describes the mechanism by which Emacs shows a matching
  565. open parenthesis when the user inserts a close parenthesis.
  566.  - Variable: blink-paren-function
  567.      The value of this variable should be a function (of no arguments)
  568.      to be called whenever a char with close parenthesis syntax is
  569.      inserted.  The value of `blink-paren-function' may be `nil', in
  570.      which case nothing is done.
  571.           *Please note:* this variable was named `blink-paren-hook' in
  572.           older Emacs versions, but since it is not called with the
  573.           standard convention for hooks, it was renamed to
  574.           `blink-paren-function' in version 19.
  575.  - Variable: blink-matching-paren
  576.      If this variable is `nil', then `blink-matching-open' does nothing.
  577.  - Variable: blink-matching-paren-distance
  578.      This variable specifies the maximum distance to scan for a matching
  579.      parenthesis before giving up.
  580.  - Function: blink-matching-open
  581.      This function is the default value of `blink-paren-function'.  It
  582.      assumes that point follows a character with close parenthesis
  583.      syntax and moves the cursor momentarily to the matching opening
  584.      character.  If that character is not already on the screen, then
  585.      its context is shown by displaying it in the echo area.  To avoid
  586.      long delays, this function does not search farther than
  587.      `blink-matching-paren-distance' characters.
  588.      Here is an example of calling this function explicitly.
  589.           (defun interactive-blink-matching-open ()
  590.             "Indicate momentarily the start of sexp before point."
  591.             (interactive)
  592.             (let ((blink-matching-paren-distance
  593.                    (buffer-size))
  594.                   (blink-matching-paren t))
  595.               (blink-matching-open)))
  596. File: elisp,  Node: Inverse Video,  Next: Usual Display,  Prev: Blinking,  Up: Emacs Display
  597. Inverse Video
  598. =============
  599.  - User Option: inverse-video
  600.      This variable controls whether Emacs uses inverse video for all
  601.      text on the screen.  Non-`nil' means yes, `nil' means no.  The
  602.      default is `nil'.
  603.  - User Option: mode-line-inverse-video
  604.      This variable controls the use of inverse video for mode lines.
  605.      If it is non-`nil', then mode lines are displayed in inverse video
  606.      (under X, this uses the face named `modeline', which you can set
  607.      as you wish).  Otherwise, mode lines are displayed normally, just
  608.      like text.  The default is `t'.
  609. File: elisp,  Node: Usual Display,  Next: Display Tables,  Prev: Inverse Video,  Up: Emacs Display
  610. Usual Display Conventions
  611. =========================
  612.    The usual display conventions define how to display each character
  613. code.  You can override these conventions by setting up a display table
  614. (*note Display Tables::.).  Here are the usual display conventions:
  615.    * Character codes 32 through 126 map to glyph codes 32 through 126.
  616.      Normally this means they display as themselves.
  617.    * Character code 9 is a horizontal tab.  It displays as whitespace
  618.      up to a position determined by `tab-width'.
  619.    * Character code 10 is a newline.
  620.    * All other codes in the range 0 through 31, and code 127, display
  621.      in one of two ways according to the value of `ctl-arrow'.  If it
  622.      is is non-`nil', these codes map to sequences of two glyphs, where
  623.      the first glyph is the ASCII code for `^'.  Otherwise, these codes
  624.      map just like the codes in the range 128 to 255.
  625.    * Character codes 128 through 255 map to sequences of four glyphs,
  626.      where the first glyph is the ASCII code for `\', and the others
  627.      are digit characters representing the code in octal.
  628.    The usual display conventions apply even when there is a display
  629. table, for any character whose entry in the active display table is
  630. `nil'.  Thus, when you set up a display table, you need only specify
  631. the the characters for which you want unusual behavior.
  632.    These variables affect the way certain characters are displayed on
  633. the screen.  Since they change the number of columns the characters
  634. occupy, they also affect the indentation functions.
  635.  - User Option: ctl-arrow
  636.      This buffer-local variable controls how control characters are
  637.      displayed.  If it is non-`nil', they are displayed as a caret
  638.      followed by the character: `^A'.  If it is `nil', they are
  639.      displayed as a backslash followed by three octal digits: `\001'.
  640.  - Variable: default-ctl-arrow
  641.      The value of this variable is the default value for `ctl-arrow' in
  642.      buffers that do not override it.  This is the same as executing the
  643.      following expression:
  644.           (default-value 'ctl-arrow)
  645.      *Note Default Value::.
  646.  - User Option: tab-width
  647.      The value of this variable is the spacing between tab stops used
  648.      for displaying tab characters in Emacs buffers.  The default is 8.
  649.      Note that this feature is completely independent from the
  650.      user-settable tab stops used by the command `tab-to-tab-stop'.
  651.      *Note Indent Tabs::.
  652. File: elisp,  Node: Display Tables,  Next: Beeping,  Prev: Usual Display,  Up: Emacs Display
  653. Display Tables
  654. ==============
  655.    You can use the "display table" feature to control how all 256
  656. possible character codes display on the screen.  This is useful for
  657. displaying European languages that have letters not in the ASCII
  658. character set.
  659.    The display table maps each character code into a sequence of
  660. "glyphs", each glyph being an image that takes up one character
  661. position on the screen.  You can also define how to display each glyph
  662. on your terminal, using the "glyph table".
  663. * Menu:
  664. * Display Table Format::    What a display table consists of.
  665. * Active Display Table::    How Emacs selects a display table to use.
  666. * Glyphs::            How to define a glyph, and what glyphs mean.
  667. * ISO Latin 1::            How to use display tables
  668.                   to support the ISO Latin 1 character set.
  669. File: elisp,  Node: Display Table Format,  Next: Active Display Table,  Up: Display Tables
  670. Display Table Format
  671. --------------------
  672.    A display table is actually an array of 261 elements.
  673.  - Function: make-display-table
  674.      This creates and returns a display table.  The table initially has
  675.      `nil' in all elements.
  676.    The first 256 elements correspond to character codes; the Nth
  677. element says how to display the character code N.  The value should be
  678. `nil' or a vector of glyph values (*note Glyphs::.).  If an element is
  679. `nil', it says to display that character according to the usual display
  680. conventions (*note Usual Display::.).
  681.    The remaining five elements of a display table serve special
  682. purposes, and `nil' means use the default stated below.
  683.      The glyph for the end of a truncated screen line (the default for
  684.      this is `$').  *Note Glyphs::.
  685.      The glyph for the end of a continued line (the default is `\').
  686.      The glyph for indicating a character displayed as an octal
  687.      character code (the default is `\').
  688.      The glyph for indicating a control character (the default is `^').
  689.      A vector of glyphs for indicating the presence of invisible lines
  690.      (the default is `...').  *Note Selective Display::.
  691.    For example, here is how to construct a display table that mimics the
  692. effect of setting `ctl-arrow' to a non-`nil' value:
  693.      (setq disptab (make-display-table))
  694.      (let ((i 0))
  695.        (while (< i 32)
  696.          (or (= i ?\t) (= i ?\n)
  697.              (aset disptab i (vector ?^ (+ i 64))))
  698.          (setq i (1+ i)))
  699.        (aset disptab 127 (vector ?^ ??)))
  700. File: elisp,  Node: Active Display Table,  Next: Glyphs,  Prev: Display Table Format,  Up: Display Tables
  701. Active Display Table
  702. --------------------
  703.    Each window can specify a display table, and so can each buffer.
  704. When a buffer B is displayed in window W, display uses the display
  705. table for window W if it has one; otherwise, the display table for
  706. buffer B if it has one; otherwise, the standard display table if any.
  707. The display table chosen is called the "active" display table.
  708.  - Function: window-display-table WINDOW
  709.      This function returns WINDOW's display table, or `nil' if WINDOW
  710.      does not have an assigned display table.
  711.  - Function: set-window-display-table WINDOW TABLE
  712.      This function sets the display table of WINDOW to TABLE.  The
  713.      argument TABLE should be either a display table or `nil'.
  714.  - Variable: buffer-display-table
  715.      This variable is automatically local in all buffers; its value in a
  716.      particular buffer is the display table for that buffer, or `nil' if
  717.      the buffer does not have any assigned display table.
  718.  - Variable: standard-display-table
  719.      This variable's value is the default display table, used when
  720.      neither the current buffer nor the window displaying it has an
  721.      assigned display table.  This variable is `nil' by default.
  722.    If neither the selected window nor the current buffer has a display
  723. table, and if the variable `standard-display-table' is `nil', then
  724. Emacs uses the usual display conventions.  *Note Usual Display::.
  725. File: elisp,  Node: Glyphs,  Next: ISO Latin 1,  Prev: Active Display Table,  Up: Display Tables
  726. Glyphs
  727. ------
  728.    A "glyph" is a generalization of a character; it stands for an image
  729. that takes up a single character position on the screen.  Glyphs are
  730. represented in Lisp as integers, just as characters are.
  731.    The meaning of each integer, as a glyph, is defined by the glyph
  732. table, which is the value of the variable `glyph-table'.
  733.  - Variable: glyph-table
  734.      The value of this variable is the current glyph table.  It should
  735.      be a vector; the Gth element defines glyph code G.  If the value
  736.      is `nil' instead of a vector, then all glyphs are simple (see
  737.      below).
  738.    Here are the possible types of elements in the glyph table:
  739. INTEGER
  740.      Define this glyph code as an alias for code INTEGER.  This is used
  741.      with X Windows to specify a face code.
  742. STRING
  743.      Send the characters in STRING to the terminal to output this
  744.      glyph.  This alternative is available on character terminals, but
  745.      not under X.
  746. `NIL'
  747.      This glyph is simple.  On an ordinary terminal, the glyph code mod
  748.      256 is the character to output.  With X, the glyph code mod 256 is
  749.      character to output, and the glyph code divided by 256 specifies
  750.      the "face id number" to use while outputting it.  *Note Faces::.
  751.    If a glyph code is greater than or equal to the length of the glyph
  752. table, that code is automatically simple.
  753. File: elisp,  Node: ISO Latin 1,  Prev: Glyphs,  Up: Display Tables
  754. ISO Latin 1
  755. -----------
  756.    If you have a terminal that can handle the entire ISO Latin 1
  757. character set, you can arrange to use that character set as follows:
  758.      (require 'disp-table)
  759.      ;; Set char codes 160--255 to display as themselves.
  760.      ;; (Codes 128--159 are the additional control characters.)
  761.      (standard-display-8bit 160 255)
  762.    If you are editing buffers written in the ISO Latin 1 character set
  763. and your terminal doesn't handle anything but ASCII, you can load the
  764. file `iso-ascii' to set up a display table which makes the other ISO
  765. characters display as sequences of ASCII characters.  For example, the
  766. character "o with umlaut" displays as `{"o}'.
  767.    Some European countries have terminals that don't support ISO Latin 1
  768. but do support the special characters for that country's language.  You
  769. can define a display table to work one language using such terminals.
  770. For an example, see `lisp/iso-swed.el', which handles certain Swedish
  771. terminals.
  772.    You can load the appropriate display table for your terminal
  773. automatically by writing a terminal-specific Lisp file for the terminal
  774. type.
  775. File: elisp,  Node: Beeping,  Next: Window Systems,  Prev: Display Tables,  Up: Emacs Display
  776. Beeping
  777. =======
  778.    You can make Emacs ring a bell (or blink the screen) to attract the
  779. user's attention.  Be conservative about how often you do this; frequent
  780. bells can become irritating.  Also be careful not to use beeping alone
  781. when signaling an error is appropriate.  (*Note Errors::.)
  782.  - Function: ding &optional DONT-TERMINATE
  783.      This function beeps, or flashes the screen (see `visible-bell'
  784.      below).  It also terminates any keyboard macro currently executing
  785.      unless DONT-TERMINATE is non-`nil'.
  786.  - Function: beep &optional DONT-TERMINATE
  787.      This is a synonym for `ding'.
  788.  - Variable: visible-bell
  789.      This variable determines whether Emacs should flash the screen to
  790.      represent a bell.  Non-`nil' means yes, `nil' means no.  This is
  791.      effective only if the Termcap entry for the terminal in use has the
  792.      visible bell flag (`vb') set.
  793. File: elisp,  Node: Window Systems,  Prev: Beeping,  Up: Emacs Display
  794. Window Systems
  795. ==============
  796.    Emacs works with several window systems, most notably the X Window
  797. Syste,.  Note that both Emacs and X use the term "window", but use it
  798. differently.  An Emacs frame is a single window as far as X is
  799. concerned; the individual Emacs windows are not known to X at all.
  800.  - Variable: window-system
  801.      This variable tells Lisp programs what window system Emacs is
  802.      running under.  Its value should be a symbol such as `x' (if Emacs
  803.      is running under X) or `nil' (if Emacs is running on an ordinary
  804.      terminal).
  805.  - Variable: window-system-version
  806.      This variable distinguishes between different versions of the X
  807.      Window System.  Its value is 10 or 11 when using X; `nil'
  808.      otherwise.
  809.  - Variable: window-setup-hook
  810.      This variable is a normal hook which Emacs runs after loading your
  811.      `.emacs' file and the default initialization file (if any), after
  812.      loading terminal-specific Lisp code, and after running the hook
  813.      `term-setup-hook'.
  814.      This hook is used for internal purposes: setting up communication
  815.      with the window system, and creating the initial window.  Users
  816.      should not interfere with it.
  817. File: elisp,  Node: Calendar,  Next: Tips,  Prev: Emacs Display,  Up: Top
  818. Customizing the Calendar and Diary
  819. **********************************
  820.    There are many customizations that you can use to make the calendar
  821. and diary suit your personal tastes.
  822. * Menu:
  823. * Calendar Customizing::   Defaults you can set.
  824. * Holiday Customizing::    Defining your own holidays.
  825. * Date Display Format::    Changing the format.
  826. * Time Display Format::    Changing the format.
  827. * Daylight Savings::       Changing the default.
  828. * Diary Customizing::      Defaults you can set.
  829. * Hebrew/Islamic Entries:: How to obtain them.
  830. * Fancy Diary Display::    Enhancing the diary display, sorting entries.
  831. * Included Diary Files::   Sharing a common diary file.
  832. * Sexp Diary Entries::     Fancy things you can do.
  833. * Appt Customizing::       Customizing appointment reminders.
  834. File: elisp,  Node: Calendar Customizing,  Next: Holiday Customizing,  Up: Calendar
  835. Customizing the Calendar
  836. ========================
  837.    If you set the variable `view-diary-entries-initially' to `t',
  838. calling up the calendar automatically displays the diary entries for
  839. the current date as well.  The diary dates appear only if the current
  840. date is visible.  If you add both of the following lines to your
  841. `.emacs' file:
  842.      (setq view-diary-entries-initially t)
  843.      (calendar)
  844. they display both the calendar and diary windows whenever you start
  845. Emacs.
  846.    Similarly, if you set the variable
  847. `view-calendar-holidays-initially' to `t', entering the calendar
  848. automatically displays a list of holidays for the current three month
  849. period.  The holiday list appears in a separate window.
  850.    You can set the variable `mark-diary-entries-in-calendar' to `t' in
  851. order to place a plus sign (`+') beside any dates with diary entries.
  852. Whenever the calendar window is displayed or redisplayed, the diary
  853. entries are automatically marked for holidays.
  854.    Similarly, setting the variable `mark-holidays-in-calendar' to `t'
  855. places an asterisk (`*') after all holiday dates visible in the
  856. calendar window.
  857.    There are many customizations that you can make with the hooks
  858. provided.  For example, the variable `calendar-load-hook', whose
  859. default value is `nil', is a normal hook run when the calendar package
  860. is first loaded (before actually starting to display the calendar).
  861.    The variable `initial-calendar-window-hook', whose default value is
  862. `nil', is a normal hook run the first time the calendar window is
  863. displayed.  The function is invoked only when you first enter Calendar
  864. mode, not when you redisplay an existing Calendar window.  But if you
  865. leave the calendar with the `q' command and reenter it, the hook runs
  866. again.
  867.    The variable `today-visible-calendar-hook', whose default value is
  868. `nil', is a normal hook run after the calendar buffer has been prepared
  869. with the calendar when the current date is visible in the window.  One
  870. use of this hook is to replace today's date with asterisks; a function
  871. `calendar-star-date' is included for this purpose.  In your `.emacs'
  872. file, put:
  873.      (setq today-visible-calendar-hook 'calendar-star-date)
  874. Another standard hook function adds asterisks around the current date.
  875. Here's how to use it:
  876.      (setq today-visible-calendar-hook 'calendar-mark-today)
  877. A corresponding variable, `today-invisible-calendar-hook', whose
  878. default value is `nil', is a normal hook run after the calendar buffer
  879. text has been prepared, if the current date is *not* visible in the
  880. window.
  881.